<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>文章分类管理</title>
</head>
<body>

	<nav class="breadcrumb">

		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>文章管理
		<span class="c-gray en">&gt;</span> 文章分类 <a
			class="btn btn-success btn-refresh radius r mt-5 mr-20"
			onclick="javascript:location.replace(location.href);"
			href="javascript:location.replace(location.href);" title="刷新">刷新</a>

		<a class="btn btn-primary radius r mt-5 mr-20"
			onclick="u_cate_add('添加文章分类','<%=basePath%>backstage/cate-add-pre')"
			href="javascript:;"> 添加文章分类</a>
	</nav>
	<div class="pd-20">
		<!-- 	<div class="cl pd-5 bg-1 bk-gray"></div> -->

		<div class="mt-20">
			<table
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">
						<!--<th width="35"><input type="checkbox" name="" value=""></th>-->
						<th width="40">ID</th>
						<th>名称</th>
						<th>文章数</th>
						<th>点击数</th>
						<th width="80">排序号</th>
						<th width="80">类型</th>
						<!--<th>添加时间</th>-->
						<th>添加人</th>
						<th>修改时间</th>
						<th>修改人</th>
						<th>允许评论</th>
						<th>是否有效</th>
						<th>是否显示日期</th>
						<th width="150">操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${u_cates}" var="u_cate">

						<tr class="text-c">
							<!--<td><input type="checkbox" value="${u_cate.id}"  id="id" name="id"></td>-->
							<td>${u_cate.id}</td>

							<td>${u_cate.cate_full_name}</td>
							<td>${u_cate.article_count}</td>
							<td>${u_cate.read_count}</td>
							<td>${u_cate.sort}</td>

							<td><c:choose>
									<c:when test="${0==u_cate.cate_type}">默认分类</c:when>
									<c:when test="${1==u_cate.cate_type}">系统分类</c:when>
									<c:when test="${2==u_cate.cate_type}">营销管理</c:when>
									<c:when test="${3==u_cate.cate_type}">育儿知识</c:when>
									<c:otherwise></c:otherwise>
								</c:choose></td>
							<!--<td></td>-->
							<td><c:forEach items="${users}" var="user">
									<c:if test="${user.user_id==u_cate.creater_id}">
										${user.user_name}
									</c:if>
								</c:forEach></td>
							<td>${u_cate.modified_time}</td>
							<td><c:forEach items="${users}" var="user">
									<c:if test="${user.user_id==u_cate.modified_by}">
										${user.user_name}
									</c:if>
								</c:forEach></td>

							<td><c:choose>
									<c:when test="${0==u_cate.allow_comment}">
										<span class="label label-warning radius">不允许</span>
									</c:when>
									<c:when test="${1==u_cate.allow_comment}">
										<span class="label label-success radius">允许</span>
									</c:when>
									<c:otherwise></c:otherwise>
								</c:choose></td>

							<td><c:choose>
									<c:when test="${0==u_cate.is_valid}">
										<span class="label label-warning radius">无效</span>
									</c:when>
									<c:when test="${1==u_cate.is_valid}">
										<span class="label label-success radius">有效</span>
									</c:when>
									<c:otherwise></c:otherwise>
								</c:choose></td>

							<td><c:choose>
									<c:when test="${0==u_cate.is_show_date}">
										<span class="label label-warning radius">不显示</span>
									</c:when>
									<c:when test="${1==u_cate.is_show_date}">
										<span class="label label-success radius">显示</span>
									</c:when>
									<c:otherwise></c:otherwise>
								</c:choose></td>

							<td class="td-manage"><a class="btn btn-warning"
								onClick="u_cate_articles(this,'${u_cate.id}')"
								href="javascript:void(0);" title="编辑">文章列表</a> &nbsp;&nbsp; <a
								class="btn btn-warning"
								onClick="u_cate_edit(this,'${u_cate.id}')"
								href="javascript:void(0);" title="编辑">编辑</a> <!--
								&nbsp;&nbsp;
								<a style="text-decoration:none"
								onClick="u_cate_delete(this,'${u_cate.id}')" href="javascript:void(0);"
								title="删除">删除</a>
								--></td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.table-sort').dataTable({
				"bStateSave" : false,
				"bSort":true
			});
			$('.table-sort tbody').on('click', 'tr', function() {
				if ($(this).hasClass('selected')) {
					$(this).removeClass('selected');
				} else {
					table.$('tr.selected').removeClass('selected');
					$(this).addClass('selected');
				}
			});
		});

		/*重置*/
		function theReset(){
			$("#search-form input[type='text']").val('');
			$("#search-form select").val(-1);
		}

		/*添加*/
		function u_cate_add(title, url, w, h) {
			var index = layer.open({
				type: 2,
				title: title,
				content: url
			});
			layer.full(index);
		}

		/*编辑*/
		function u_cate_edit(obj,id,w,h){
			var edit_page = "<%=basePath%>backstage/cate-add-pre?id="+id;
			var index = layer.open({
				type: 2,
				title: '编辑分类',
				content: edit_page
			});
			layer.full(index);
		}

		/*分类下文章列表*/
		function u_cate_articles(obj,cate_id){
			var edit_page = "<%=basePath%>backstage/webarticlelist?cate_id="+cate_id;
			var index = layer.open({
				type: 2,
				title: "文章列表",
				content: edit_page
			});
			layer.full(index);
		}
		/*删除*/
		function u_cate_delete(obj,cate_id){
			layer.confirm('确认删除？', {
				btn: ['确认','取消'], 
				shade: false
			},
			function(){
				$.ajax({
					type : "POST",
					url : "<%=basePath%>backstage/cate-delete",
							data : {
								id : cate_id
							},
							dataType : "json",
							error : function() {
								layer.msg('操作失败', {
									icon : 5,
									time : 2000
								});
							},
							success : function(msg) {
								if (msg.error == "0000") {
									layer.msg('' + msg.information, {
										icon : 6,
										time : 5000
									});
									$(obj).parents("body").find(".btn-refresh")
											.click();
								} else {
									layer.msg(' ' + msg.information, {
										icon : 5,
										time : 5000
									});
								}
							}
						});
			}, function() {
				layer.msg('未删除', {
					icon : 5,
					time : 1000
				});
			});
		}
	</script>
</body>
</html>



